package com.jade.bss.base.account;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;

/**
 * 企业账户。一个企业包括多种类型的账户，每个账户包括余额、预缴未确认、冻结额度。
 * 账户可用额度=余额-预缴未确认额度-冻结额度。额度可以是数量，也可以是金额，根据具体应用而定。
 *
 * @author dwzhang
 * @version 1.0 12-04-22 下午9:07
 */
@Entity
@Table (name = "BSS_ACCOUNT")
public class Account implements Serializable
{
    public static String DEFAULT_ACCOUNT_TYPE = "default";
    /** 账户标识 */
    @Id
    @GeneratedValue (generator = "SEQ_BSS_ACCOUNT")
    @SequenceGenerator (name = "SEQ_BSS_ACCOUNT", sequenceName = "SEQ_BSS_ACCOUNT")
    private long id;
    /** 标识 */
    @Column (name = "owner_id", nullable = false)
    private String ownerId;
    /** 标识 */
    @Column (name = "owner_type", nullable = false)
    private String ownerType;
    /** 账户类型 */
    @Column (name = "type", nullable = false, length = 16)
    private String type = DEFAULT_ACCOUNT_TYPE;
    /** 账户名称 */
    @Column (name = "name", nullable = false, length = 64)
    private String name;
    /** 余额 */
    @Column (name = "remnant", nullable = false)
    private long remnant = 0;
    /** 预付未确认 */
    @Column (name = "prepay", nullable = false)
    private long prepay = 0;
    /** 冻结额度 */
    @Column (name = "freeze", nullable = false)
    private long freeze = 0;
    /** 企业账套创建时间 */
    @Column (name = "creation_date", nullable = false)
    protected Date creationDate = new Date();
    /** 账号有效开始时间 */
    @Column (name = "start_date", nullable = false)
    protected Date startDate = new Date();
    /** 账号有效结束时间 */
    @Column (name = "end_date", nullable = false)
    protected Date endDate = new Date();
    public long getId()
    {
        return id;
    }

    public void setId(long id)
    {
        this.id = id;
    }

    public String getOwnerId()
    {
        return ownerId;
    }

    public void setOwnerId(String ownerId)
    {
        this.ownerId = ownerId;
    }

    public String getOwnerType()
    {
        return ownerType;
    }

    public void setOwnerType(String ownerType)
    {
        this.ownerType = ownerType;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public long getRemnant()
    {
        return remnant;
    }

    public void setRemnant(long remnant)
    {
        this.remnant = remnant;
    }

    public long getPrepay()
    {
        return prepay;
    }

    public void setPrepay(long prepay)
    {
        this.prepay = prepay;
    }

    public long getFreeze()
    {
        return freeze;
    }

    public void setFreeze(long freeze)
    {
        this.freeze = freeze;
    }
}
